package ex.algorithms.sorting;

public class SelectionSort {
	public static void sortIncreasing(int[] input) {
		if(input == null || input.length < 2)
			return;
		
		for(int j=0; j<input.length; j++) {
			int min = input[j];
			int minIndex = j;
			for(int i=j+1; i<input.length; i++) {
				if(input[i] < min) {
					min = input[i];
					minIndex = i;
				}
			}
			int tmp = input[j]; 
			input[j] = min;
			input[minIndex] = tmp;
		}
	}
}
